

void UI_LineBisectorOptions::destroy() {
    PF_SETTINGS->beginGroup("/Draw");
    PF_SETTINGS->writeEntry("/LineBisectorLength", leLength->text());
    PF_SETTINGS->writeEntry("/LineBisectorNumber", sbNumber->text());
    PF_SETTINGS->endGroup();
}

void UI_LineBisectorOptions::setAction(PF_ActionInterface* a, bool update) {
    if (a!=NULL && a->rtti()==LX_Define::ActionDrawLineBisector) {
        action = (WF_DrawLineBisector*)a;

        QString sl;
        QString sn;
        if (update) {
            sl = QString("%1").arg(action->getLength());
            sn = QString("%1").arg(action->getNumber());
        } else {
            PF_SETTINGS->beginGroup("/Draw");
            sl = PF_SETTINGS->readEntry("/LineBisectorLength", "1.0");
            sn = PF_SETTINGS->readEntry("/LineBisectorNumber", "1");
            PF_SETTINGS->endGroup();
        }
        leLength->setText(sl);
        sbNumber->setValue(sn.toInt());
    } else {
        PF_DEBUG->print(PF_Debug::D_ERROR, 
			"UI_LineBisectorOptions::setAction: wrong action type");
        action = NULL;
    }
}

void UI_LineBisectorOptions::updateLength(const QString& l) {
    if (action!=NULL) {
        action->setLength(PF_Math::eval(l));
    }
}

void UI_LineBisectorOptions::updateNumber(int n) {
    if (action!=NULL) {
        action->setNumber(n);
    }
}
